package com.jiawa.wiki.service;

import com.jiawa.wiki.websocket.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * WS Service
 *
 * @author 荀彧 2021/5/23
 */
@Service
@Slf4j
public class WsService {

    @Resource
    WebSocketServer socketServer;

    @Async
    public void sendInfo(String info, String logId) {
        MDC.put("LOG_ID", logId);
        socketServer.sendInfo(info);
    }
}

